#ifndef USERVECTOR_H
#define USERVECTOR_H

#include <QVector>
#include <iostream>
#include "user_struct.h"

class userVector : public QVector<user>
{
public:
    userVector(){}
    ~userVector(){}
    QString getNickById(int id)
    {

        for(int i = 0; i < size(); i++)
        {
            if( id == this->at(i).id)
                return this->at(i).nick;
        }
        return QString("unknown2 user");
    }
    void deleteUserById(int id)
    {
        for(int i = 0; i < size(); i++)
            if( id == this->at(i).id)
            {
                this->remove(i);
                break;
            }
    }
    void changeUserStatusById(int id,int status_id, QString status)
    {
        for(int i = 0; i < size(); i++)
            if( id == this->at(i).id)
            {
                user tmp = this->at(i);

                tmp.status_id = status_id;
                tmp.statusMessage = status;
                this->replace(i,tmp);
                break;
            }
    }
};

#endif // USERVECTOR_H
